﻿CREATE PROCEDURE [DBOrderService.spPosition]
	@start_date DateTime,
	@end_date DateTime,
	@booking_path Varchar(255)
AS
	--SET DATEFORMAT YMD

	--declare @longleg float;
	--select @longleg = sum(+ Quantity * Price) from DBOrderService.DBOrderExecution 
		--where Way = 'Buy' 
			--and TimeStamp>=@start_date 
			--and TimeStamp<=@end_date
			--and Path Like @booking_path;
	--declare @shortleg float;
	--select @shortleg = sum(+ Quantity * Price) from DBOrderService.DBOrderExecution 
			--where Way = 'Sell' 
			--and TimeStamp>=@start_date 
			--and TimeStamp<=@end_date
			--and Path Like @booking_path;
			
	--declare @position float;
	--select @position = @longleg - @shortleg;
	--select @position;
--RETURN @position